package com.shsh.safemanage.model;

import java.util.Calendar;

import com.shsh.safemanage.util.Constants;

public class AccidentFacade {
	private final AbstractAccident facadeAccident;
	private AccidentRegisterForm registerForm = new AccidentRegisterForm();
	private AccidentInfoSheet infoSheet = new AccidentInfoSheet();
	private AccidentQuickReport quickReport = new AccidentQuickReport();
	private AccidentReport report = new AccidentReport();
	private AccidentCheckForm checkForm1 = new AccidentCheckForm();
	private AccidentCheckForm checkForm2 = new AccidentCheckForm();
	private AccidentCheckForm checkForm3 = new AccidentCheckForm();

	public AccidentFacade(AbstractAccident facadeAccident) {
		super();
		this.facadeAccident = facadeAccident;
	}

	public AccidentFacade(AccidentRegisterForm registerForm, AccidentInfoSheet infoSheet, AccidentQuickReport quickReport,
			AccidentReport report, AccidentCheckForm checkForm1, AccidentCheckForm checkForm2, AccidentCheckForm checkForm3) {
		super();
		if (registerForm != null) {
			facadeAccident = registerForm;
		} else if (infoSheet != null) {
			facadeAccident = infoSheet;
		} else if (quickReport != null) {
			facadeAccident = quickReport;
		} else if (report != null) {
			facadeAccident = report;
		} else if (checkForm1 != null) {
			facadeAccident = checkForm1;
		} else if (checkForm2 != null) {
			facadeAccident = checkForm2;
		} else if (checkForm3 != null) {
			facadeAccident = checkForm3;
		} else {
			throw new IllegalArgumentException("Cannot create an AccidentFace with all forms are null");
		}

		this.registerForm = registerForm;
		this.infoSheet = infoSheet;
		this.quickReport = quickReport;
		this.report = report;
		this.checkForm1 = checkForm1;
		this.checkForm2 = checkForm2;
		this.checkForm3 = checkForm3;
	}

	/**
	 * FACADE_ID
	 * 
	 * @return
	 */
	public Long getId() {
		return this.facadeAccident.getFacadeID();
	}

	public Long getDepartment1ID() {
		return this.facadeAccident.getDepartment1ID();
	}

	public String getDepartment1Name() {
		return this.facadeAccident.getDepartment1Name();
	}

	public String getEquipmentName() {
		return this.facadeAccident.getEquipmentName();
	}

	public Long getEquipmentID() {
		return this.facadeAccident.getEquipmentID();
	}

	public Integer getAccidentTypeID() {
		return this.facadeAccident.getAccidentTypeID();
	}

	public String getAccidentType() {
		return this.facadeAccident.getAccidentType();
	}

	public String getAccidentName() {
		return this.facadeAccident.getAccidentName();
	}

	public Calendar getAccidentTime() {
		return this.facadeAccident.getAccidentTime();
	}

	public AccidentInfoSheet getInfoSheet() {
		return infoSheet;
	}

	public void setInfoSheet(AccidentInfoSheet infoSheet) {
		this.infoSheet = infoSheet;
	}

	public AccidentQuickReport getQuickReport() {
		return quickReport;
	}

	public void setQuickReport(AccidentQuickReport quickReport) {
		this.quickReport = quickReport;
	}

	public AccidentReport getReport() {
		return report;
	}

	public void setReport(AccidentReport report) {
		this.report = report;
	}

	public AccidentCheckForm getCheckForm1() {
		return checkForm1;
	}

	public void setCheckForm1(AccidentCheckForm checkForm1) {
		this.checkForm1 = checkForm1;
	}

	public AccidentCheckForm getCheckForm2() {
		return checkForm2;
	}

	public void setCheckForm2(AccidentCheckForm checkForm2) {
		this.checkForm2 = checkForm2;
	}

	public AccidentCheckForm getCheckForm3() {
		return checkForm3;
	}

	public void setCheckForm3(AccidentCheckForm checkForm3) {
		this.checkForm3 = checkForm3;
	}

	public AccidentRegisterForm getRegisterForm() {
		return registerForm;
	}

	public void setRegisterForm(AccidentRegisterForm registerForm) {
		this.registerForm = registerForm;
	}

	public boolean hasComplete() {
		if (Constants.ACCIDENT_STATUS_COMPLETE == registerForm.getProcessStatus()) {
			return true;
		}

		return false;
	}
}
